// run: $exec < input
#include <iostream>
#include <iomanip>
#include <cstring>
#include <cmath>

int main()
{
	int T; std::cin >> T;
	while (T--) {
		double H, h, D;
		std::cin >> H >> h >> D;
		double x1 = (H - h) * D / H;
		double x2 = D;
		double x0 = sqrt(D * (H - h));
		double x;
		if (x1 <= x0 && x0 <= x2) x = x0;
		else if (x0 <= x1) x = x1;
		else x = x2;

		double ans = D + H- (x + (H - h) * D / x);
		std::cout << std::fixed << std::setprecision(3) << ans << '\n';
	}
}

